//
//  BVBalanceDetail.m
//  BuyVegetable
//
//  Created by zhuzi on 16/10/21.
//  Copyright © 2016年 com.yinding. All rights reserved.
//

#import "BVBalanceDetailViewController.h"
#import "BVNavItem.h"
#import "BVRechargeViewController.h"
#import "BVBalanceHeandView.h"

@interface BVBalanceDetailViewController ()
@property (nonatomic,strong)BVBalanceHeandView * headView;
@end

@implementation BVBalanceDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setNav];
    [self setUI];
}
- (void)setNav{
    self.navigationItem.title = @"余额明细";
    BVNavItem *registerItem = [BVNavItem buttonWithType:UIButtonTypeCustom];
    [registerItem setTitle:@"充值" forState:UIControlStateNormal];
    [registerItem addTarget:self action:@selector(goRecharge) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:registerItem];
}
#pragma mark - 去充值
- (void)goRecharge{
    
     BVRechargeViewController *recharge = [[BVRechargeViewController alloc] init];
     [self.navigationController pushViewController:recharge animated:YES];
}
-(void)setUI{
    
    self.view.backgroundColor = [UIColor BVBackgroundLightGrayColor];
    
    CGSize maximumLabelSize = CGSizeMake(100, 9999);//labelsize的最大值
    UILabel * balanceTitel = [[UILabel alloc]init];
    balanceTitel.text = @"账户余额";
    balanceTitel.textColor = [UIColor BVBaseOrangeColor];
    balanceTitel.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:balanceTitel];
    balanceTitel.sd_layout
    .topSpaceToView(self.view,5)
    .leftSpaceToView(self.view,10)
    .rightSpaceToView(self.view,10)
    .heightIs(20);
    
    UILabel * CNYLabel = [[UILabel alloc]init];
    CNYLabel.text = @"¥";
    CNYLabel.textColor = [UIColor BVBaseOrangeColor];
    CGSize CNYLabelExpectSize = [CNYLabel sizeThatFits:maximumLabelSize];
    [self.view addSubview:CNYLabel];
    CNYLabel.sd_layout
    .topSpaceToView(balanceTitel,5)
    .leftSpaceToView(self.view,10)
    .widthIs(CNYLabelExpectSize.width)
    .heightIs(20);
    
    UILabel * balanceNumber = [[UILabel alloc]init];
    balanceNumber.text = @"0.00";
    balanceNumber.font = [UIFont systemFontOfSize:20];
     balanceNumber.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
    balanceNumber.textColor = [UIColor BVBaseOrangeColor];
    CGSize balanceNumberExpectSize = [balanceNumber sizeThatFits:maximumLabelSize];
    [self.view addSubview:balanceNumber];
    balanceNumber.sd_layout
    .topSpaceToView(balanceTitel,5)
    .leftSpaceToView(CNYLabel,10)
    .widthIs(balanceNumberExpectSize.width)
    .heightIs(20);
    
    UILabel * freezeLabel = [[UILabel alloc]init];
    freezeLabel.text = @"(冻结: ¥0.00)";
    freezeLabel.font = [UIFont systemFontOfSize:15];
    freezeLabel.textColor = [UIColor BVBaseOrangeColor];
    [self.view addSubview:freezeLabel];
    freezeLabel.sd_layout
    .topSpaceToView(balanceTitel,5)
    .leftSpaceToView(balanceNumber,10)
    .rightSpaceToView(self.view,10)
    .heightIs(20);
    
    UILabel * noteLabel = [[UILabel alloc]init];
    noteLabel.text = @"由于部分商品实行结算称重，所以会有订单冻结金额";
    noteLabel.font = [UIFont systemFontOfSize:14];
    noteLabel.textColor = [UIColor BVBaseOrangeColor];
    noteLabel.numberOfLines = 0;
    [self.view addSubview:noteLabel];
    noteLabel.sd_layout
    .topSpaceToView(balanceNumber,5)
    .leftSpaceToView(self.view,10)
    .rightSpaceToView(self.view,0)
    .autoHeightRatio(0);
    
    NSArray * arryTitel = [NSArray arrayWithObjects:@"全部明细",@"收入明细",@"支出明细" ,nil];
    _headView = [[BVBalanceHeandView alloc]initWithTitelArray:arryTitel];
    [self.view addSubview:_headView];
    _headView.delegate = self;
    
    _headView.sd_layout
    .topSpaceToView(noteLabel,0)
    .leftSpaceToView(self.view,0)
    .rightSpaceToView(self.view,0)
    .heightIs(40);
    
}
#pragma mark - 滑动按钮的点击事件
-(void)getIndex:(NSInteger*)index{
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
